<template>
	<view>
		<TabMenu :menus="tabList" :tabCur="tabCur" ref="tableMenu" @clickCtTab="clickCtTab"></TabMenu>
		<!-- 内容信息 -->
		<template v-if="withdrawalList.length>0">
			<view>
				<view class="wdinfo_List" v-for="(item,index) in withdrawalList" :key="item.id">
					<view class="info_header">
						<text>订单号：{{item.no}}</text>
						<text class="f_green" v-if="item.state==0">待处理</text>
						<text class="f_green" v-if="item.state==1">已通过</text>
						<text class="f_green" v-if="item.state==2">已拒绝</text>
					</view>
					<view>店铺名：{{item.storeName}}</view>
					<view>提现金额：<text class="f_red">{{item.withDrawalMoney}}</text></view>
					<view>申请时间：{{item.withDrawalTime}}</view>
					<view class="tx_list">
						<view class="tx_btn">提现方式:</view>
						<text v-if="item.withDrawalWay==1">WX</text>
						<text v-if="item.withDrawalWay==0">ZFB</text>
						<text v-if="item.withDrawalWay==2">YHK</text>
					</view>
				</view>
			</view>
		</template>
		<Nodata v-else></Nodata>
	</view>
</template>

<script>
	import {
		getwithdrawalList
	} from '@/request/api/withdrawInfo.js'
	import TabMenu from '@/components/TabMenu.vue'
	import Nodata from '@/components/Nodata.vue'
	export default {
		name: 'withdrawinfo',
		components: {
			TabMenu,
			Nodata
		},
		activated() {
			this.tabCur = uni.getStorageSync('abc') // 输出 'value1'
			this.$refs.tableMenu.clickCtTab(this.tabCur)
		},
		mounted() {
			this.tabCur = uni.getStorageSync('abc') // 输出 'value1'
			this.$refs.tableMenu.clickCtTab(this.tabCur)
		},
		onHide() {
			uni.setStorageSync('abc', 0)
		},
		data() {
			return {
				tabCur: 0,
				tabList: [{
					title: '全部',
				}, {
					title: '待转账',
				}, {
					title: '已打款',
				}, {
					title: '失败',
				}],
				withdrawalList: [{
					id: '', //主键自增ID
					userId: '', //用户ID,
					withDrawalMoney: '', //提现金额
					withDrawalWay: '', //0: 支付宝收款,1:微信收款;2:银行卡收款
					withDrawalTime: '', //提现时间
					createTime: '', //日期
					storeId: '', //店铺id
					state: '', //0:待转转,1:已经打款,2:失败,
					storeName: '', //店铺名称,
					no: '', //订单号
				}]
			}
		},
		methods: {
			clickCtTab(ctCur) {
				this.tabCur = ctCur
				this.getwithdrawal(this.tabCur - 1)
			},
			async getwithdrawal(state) {
				const res = await getwithdrawalList(state)
				this.withdrawalList = res.data
			}
		},
		onShow() {
			this.withdrawalList = []
		}
	}
</script>

<style scoped>
	.menu_container {
		display: flex;
		flex-flow: row nowrap;
		justify-content: space-between;
		align-items: center;
	}

	.menu_container .menu_item {
		display: flex;
		text-align: center;
		flex: 1;
	}

	.f_green {
		color: #288F1A;
	}

	.f_red {
		color: #fc4141;
	}

	.wdinfo_List {
		display: flex;
		flex-direction: column;
		margin-top: 10px;
		background: white;
		padding: 0 15px;
		padding-bottom: 20px;
	}

	.wdinfo_List .info_header {
		display: flex;
		flex-direction: row;
		border-bottom: .5px solid #eee;
		justify-content: space-between;
		height: 49px;
		color: #999;
		align-items: center;
	}

	.wdinfo_List .tx_list {
		display: flex;
		flex-direction: row;
	}

	.wdinfo_List .tx_list .tx_btn {
		background-color: wheat;
		width: 65px;
		color: white;
		margin-right: 10px;
	}
</style>